package mywebapps.security.jsf;

import javax.annotation.PostConstruct;

import mywebapps.security.dao.UserDao;
import mywebapps.security.model.User;

public class DeleteUserAction
{
    private UserDao userDao;
    private User user;
    private String userId;
    
    @PostConstruct
    public void init()
    {
        user = userDao.getUser(Integer.valueOf(userId));
    }

    public User getUser()
    {
        return user;
    }

    public void setUserDao(UserDao userDao)
    {
        this.userDao = userDao;
    }
    
    public String getUserId()
    {
        return userId;
    }

    public void setUserId(String userId)
    {
        this.userId = userId;
    }    
    
    public String confirmDelete()
    {
        userDao.deleteUser(Integer.valueOf(userId));
        return "gotoViewUsers";
    }
}
